package com.homedo.async.mysql.support.convertor.forfieldval;

import io.vertx.sqlclient.data.Numeric;

import java.math.BigDecimal;

/**
 * @author jgshun
 * @date 2020/1/20 11:51 AM
 */
public class BigDecimalResultFieldValConvertor implements ResultFieldValConvertorI {
    private static final BigDecimalResultFieldValConvertor INSTANCE = new BigDecimalResultFieldValConvertor();

    public static BigDecimalResultFieldValConvertor getInstance() {
        return INSTANCE;
    }


    @Override
    public BigDecimal convertor(Object columnVal) {
        if (columnVal == null) {
            return null;
        }
        return ((Numeric) columnVal).bigDecimalValue();
    }

}
